/*
package com.own.demo.lwf.utils.workUtils;

import cn.hsa.cep.plc.std.api.admdvs.dto.AdmdvsDTO;
import cn.hsa.cep.plc.std.api.admdvs.dto.QAdmdvsDTO;
import cn.hsa.cep.plc.std.api.admdvs.service.QueryAdmdvsService;
import cn.hsa.cep.plc.std.api.rule.dto.RuleDTO;
import cn.hsa.cep.plc.std.common.adapt.dict.entity.DataDictDO;
import cn.hsa.cep.plc.std.common.adapt.dict.entity.TaDictCache;
import cn.hsa.cep.plc.std.common.adapt.dict.util.DictUtils;
import cn.hsa.cep.plc.std.common.business.domain.CurrentUserInfo;
import cn.hsa.cep.plc.std.common.core.utils.ObjectConversionUtil;
import cn.hsa.cep.plc.std.common.core.utils.StringUtils;
import cn.hsa.cep.plc.std.rule.utils.MapBuilder;
import cn.hsa.cep.plc.std.rule.utils.RuleUtil;
import cn.hsa.hsaf.auth.security.utils.SpringContextUtils;
import cn.hsa.hsaf.core.framework.context.HsafContextHolder;
import cn.hsa.hsaf.core.framework.util.CurrentUser;
import cn.hsa.hsaf.core.framework.web.WrapperResponse;
import cn.hsa.mbs.api.mbscommon.dto.PublicUserInfoDTO;
import cn.hsa.mbs.common.businessrollback.dto.RollbackOptStasDTO;
import cn.hsa.mbs.common.cache.util.BusinessCacheUtil;
import cn.hsa.mbs.common.exception.MbsException;
import cn.hsa.mbs.common.hsafcontextholder.MbsHsafContextHolder;
import cn.hsa.mbs.common.lock.RedisLock;
import cn.hsa.mbs.common.lock.RedisLockFactory;
import cn.hsa.mbs.common.utils.dto.ExpiryMap;
import cn.hsa.mbs.insumgt.insmgtcommon.dto.InsuChgDetlDTO;
import cn.hsa.mbs.insumgt.insmgtcommon.dto.PrcInsertInfoDTO;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.own.demo.lwf.utils.workUtils.dto.ExpiryMap;
import com.sun.javaws.CacheUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

*/
/**
 * 公共业务常用方法
 * @author
 * @since 2019/12/21 11:55
 *//*

@Component
@Slf4j
public class BaseUtil {

    private static final String CLASS_ALIAS = "BaseUtil";

    private static ExpiryMap<String,String> insuMap =new ExpiryMap<String,String>();

    private static QueryAdmdvsService queryAdmdvsService1;

    public static final Map<String,String> bizEvtTypeMap=createBizTypeMap();

    private static RedisLockFactory redisLockFactory;



    @Resource
    QueryAdmdvsService queryAdmdvsService;
    @Resource
    RedisLockFactory redisLockFactory1;


    */
/**
     * 回退时，计算回退后复核标志状态
     * @param rchkFlagOld 原复核标志
     * @return
     *//*

    public static RollbackOptStasDTO getNewRchkFlagForRB(String rchkFlagOld, String taskId) throws Exception {
        String rchkFlagNew;
        String rchkStas;   // 回退类型
        String rchkChgType= WorkFlowUtil.getRollBackType(taskId);
//        boolean isNoChkPrcs =  WorkFlowUtil.isNoChkPrcs(taskId);
//        // 1.经办复核一步完成
//        if(isNoChkPrcs){
//            rchkFlagNew = BusinessConst.RCHK_FLAG_4_YHT;
//            rchkStas = BusinessConst.RCHKTYPE_3_FH2YHT;   // 回退类型：复核到已回退
//        }else{
//            // 2.经办复核分开两步
//            // 审核通过、审核未通过
//            if(BusinessConst.RCHK_FLAG_1_FHTG.equals(rchkFlagOld) || BusinessConst.RCHK_FLAG_2_FHBTG.equals(rchkFlagOld)) {
//                rchkFlagNew = BusinessConst.RCHK_FLAG_0_WFH;
//                rchkStas = BusinessConst.RCHKTYPE_1_FH2WFH;     // 回退类型：复核到未复核
//            // 未复核
//            }else if(BusinessConst.RCHK_FLAG_0_WFH.equals(rchkFlagOld)) {
//                rchkFlagNew = BusinessConst.RCHK_FLAG_4_YHT;
//                rchkStas = BusinessConst.RCHKTYPE_2_WFH2YHT;  // 回退类型：未复核到已回退
//            }else{
//                rchkFlagNew = null;
//                rchkStas = null;
//            }
//        }
        RollbackOptStasDTO rollbackOptStasDTO = new RollbackOptStasDTO();
        rollbackOptStasDTO.setRchkType(rchkChgType);
        rollbackOptStasDTO.setRchkFlagNew(Arrays.asList(new String[]{BusinessConst.RCHKTYPE_4_WFH2WFH, BusinessConst.RCHKTYPE_1_FH2WFH}).contains(rchkChgType)
                ? BusinessConst.RCHK_FLAG_0_WFH: BusinessConst.RCHK_FLAG_4_YHT);
        rollbackOptStasDTO.setRchkFlagOld(rchkFlagOld);
        return rollbackOptStasDTO;
    }

    @PostConstruct
    public void init() {
        queryAdmdvsService1=this.queryAdmdvsService;
        redisLockFactory = this.redisLockFactory1;
    }

        */
/**
         * 日期类变量转换为YYYYMM格式的期别整型变量
         * @param date
         * @return
         *//*

    public static int DateToYearMonth(Date date)
    {
        int result = 0;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
        String strDate = sdf.format(date);
        result = Integer.parseInt(strDate);

        return result;
    }
    */
/**
     * 期号增减
     *
     * @param issue   传入期号
     * @param counter 月数
     * @return
     * @throws Exception
     *//*

    public static int issueRegulation(Integer issue, Integer counter)  {
        Integer year = issue / 100;
        Integer months = issue % 100;
        if (counter / 12 != 0) {
            year += counter / 12;
        }
        if (months + counter % 12 > 12) {
            year += 1;
            months = months + counter % 12 - 12;
        } else if (months + counter % 12 <= 0) {
            year -= 1;
            months = months + counter % 12 + 12;
        } else {
            months += counter % 12;
        }
        return year * 100 + months;
    }

    */
/**
     * 公共服务
     * @author
     * @since 2020/3/21 10:48
     *//*

    public static void setCurrentUserForPublicSer(PublicUserInfoDTO publicUserInfoDTO){
        //清空上下文
        MbsHsafContextHolder.getContext().removeAllProperties();
        log.info("清空当前线程变量，设置当前线程[" + Thread.currentThread().getName() + "]MbsHsafContextHolder上下文内容");

        CurrentUser currentUser = HsafContextHolder.getContext().getCurrentUser();
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrterId()) && ValidateUtil.isEmpty(currentUser.getUserAcctID())){
            currentUser.setUserAcctID(publicUserInfoDTO.getCrterId());
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrterId()) && ValidateUtil.isEmpty(currentUser.getUactID())){
            currentUser.setUactID(publicUserInfoDTO.getCrterId());     //经办人
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrterName()) && ValidateUtil.isEmpty(currentUser.getName())){
            currentUser.setName(publicUserInfoDTO.getCrterName());   //经办人名称
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrteOptinsNo()) && ValidateUtil.isEmpty(currentUser.getOrgUntID())){
            currentUser.setOrgUntID(publicUserInfoDTO.getCrteOptinsNo());  //经办机构
        }
        if (ValidateUtil.isNotEmpty(currentUser.getOrgName()) && ValidateUtil.isEmpty(currentUser.getOrgName())) {
            currentUser.setOrgName("公共服务");  //经办机构
        }
        if (ValidateUtil.isNotEmpty(currentUser.getOrgCodg()) && ValidateUtil.isEmpty(currentUser.getOrgCodg())){
            currentUser.setOrgCodg("999999");  //所属组织机构编码
        }

        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getAdmDvs()) && ValidateUtil.isEmpty(currentUser.getAdmDvs())){
            currentUser.setPoolAreaCodg(publicUserInfoDTO.getAdmDvs());//统筹区
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getAdmDvs()) && ValidateUtil.isEmpty(currentUser.getAdmDvs())){
            currentUser.setAdmDvs(publicUserInfoDTO.getAdmDvs());//医保区划
        }
    }

    */
/**
     * 税务服务
     * @author
     * @since 2020/3/21 10:48
     *//*

    public static void setCurrentUserForTax(PublicUserInfoDTO publicUserInfoDTO){
        //清空上下文
        MbsHsafContextHolder.getContext().removeAllProperties();
        log.info("清空当前线程变量，设置当前线程[" + Thread.currentThread().getName() + "]MbsHsafContextHolder上下文内容");

        CurrentUser currentUser = HsafContextHolder.getContext().getCurrentUser();
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrterId()) && ValidateUtil.isEmpty(currentUser.getUserAcctID())){
            currentUser.setUserAcctID(publicUserInfoDTO.getCrterId());
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrterId()) && ValidateUtil.isEmpty(currentUser.getUactID())){
            currentUser.setUactID(publicUserInfoDTO.getCrterId());     //经办人
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrterName()) && ValidateUtil.isEmpty(currentUser.getName())){
            currentUser.setName(publicUserInfoDTO.getCrterName());   //经办人名称
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getCrteOptinsNo()) && ValidateUtil.isEmpty(currentUser.getOrgUntID())){
            currentUser.setOrgUntID(publicUserInfoDTO.getCrteOptinsNo());  //经办机构
        }
        if (ValidateUtil.isNotEmpty(currentUser.getOrgName()) && ValidateUtil.isEmpty(currentUser.getOrgName())) {
            currentUser.setOrgName("税务服务");  //经办机构
        }
        if (ValidateUtil.isNotEmpty(currentUser.getOrgCodg()) && ValidateUtil.isEmpty(currentUser.getOrgCodg())){
            currentUser.setOrgCodg("666666");  //所属组织机构编码
        }

        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getAdmDvs()) && ValidateUtil.isEmpty(currentUser.getAdmDvs())){
            currentUser.setPoolAreaCodg(publicUserInfoDTO.getAdmDvs());//统筹区
        }
        if (ValidateUtil.isNotEmpty(publicUserInfoDTO.getAdmDvs()) && ValidateUtil.isEmpty(currentUser.getAdmDvs())){
            currentUser.setAdmDvs(publicUserInfoDTO.getAdmDvs());//医保区划
        }
    }

    public static PrcInsertInfoDTO getPrcInsert(CurrentUserInfo currentUserInfo) throws Exception {
        CurrentUser currentUser = HsafContextHolder.getContext().getCurrentUser();
        // 20200226 由于mockUser数据里封装的数据与实际行政区划数据不一致，为应对本机测试时使用，对mock数据进行改造
//        if("mockuser".equalsIgnoreCase(currentUser.getUserAcct())||"开发者".equals(currentUser.getName())||WorkFlowUtil.ISLOCAL){
//            currentUser.setAdmDvs("100000");
//        }
        Date date = DateUtil.getDrdsDbDate();
        PrcInsertInfoDTO prcInsertInfo = new PrcInsertInfoDTO();
        prcInsertInfo.setPoolareaNo(currentUser.getAdmDvs());
        prcInsertInfo.setOpterId(currentUser.getUserAcctID());           // 经办人
        prcInsertInfo.setOpterName(currentUser.getName());    // 经办人姓名
        prcInsertInfo.setOptinsNo(currentUser.getOrgUntID());          // 经办机构
        prcInsertInfo.setOptTime(date);                     // 经办时间
        prcInsertInfo.setCrterId(currentUser.getUserAcctID());           // 创建人
        prcInsertInfo.setCrterName(currentUser.getName());    // 创建人姓名
        prcInsertInfo.setCrteOptinsNo(currentUser.getOrgUntID());      // 创建机构
        prcInsertInfo.setCrteTime(date);                     // 创建时间
        prcInsertInfo.setInsuAdmdvs(currentUser.getAdmDvs());
        return prcInsertInfo;
    }


    */
/**
     * 复制List值，对两个list内的元素进行复制
     * @Param: clazz 复制List内的元素类
     * @Param: sourceList 被复制的List集合
     * @return: List<T> 返回复制后的List集合
     * @author:
     * @date: 2019/12/12
     **//*

    public static <T, U> List<T> copyList(Class<T>  clazz, List<U> sourceList) throws MbsException {
        T t;
        List<T> returnList = new ArrayList<>();
        try {
            for(U temp : sourceList){
                t = clazz.newInstance();
                ObjectConversionUtil.convert(t, temp);
                returnList.add(t);
            }
        } catch (Exception e){
            throw new MbsException(e.getMessage());
        }
        return returnList;
    }

    */
/**
     * @param n 修改后的对象
     * @param items 从变更详情表里查出来的变更项
     * @return 修改前的对象
     *//*

    public static<N,Item extends InsuChgDetlDTO> N revertToChgBefore(N n, List<Item> items) throws Exception {
        N nclone;
        try {
            nclone = (N) n.getClass().newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new MbsException("实例化对象失败"+e.getMessage());
        }
        ObjectConversionUtil.convert(nclone,n);
        Field[] fields=n.getClass().getDeclaredFields();
        List<String> fieldNames = new ArrayList<>();
        Map fieldMap = new HashMap();
        for(int i=0;i<fields.length;i++){
            fieldNames.add(fields[i].getName());
            fieldMap.put(fields[i].getName(),fields[i].getType());
        }
        for(InsuChgDetlDTO chgDetlDTO:items){
            String item = underlineToCamel(chgDetlDTO.getChgItem());
            if(fieldNames.contains(item)){
                try {
                    Class<?> typeClass = (Class<?>) fieldMap.get(item);
                    Method method = null;
                    if (nclone != null) {
                        method = nclone.getClass().getMethod("set"+item.toUpperCase().charAt(0)+item.substring(1), typeClass);
                    }
                    if(typeClass.isAssignableFrom(Date.class)){
                       //todo 增加分秒的处理 ?
                       Date val = DateUtil.str2Date(chgDetlDTO.getChgOldVal(), "yyyy-MM-dd");
                        if (method != null) {
                            method.invoke(nclone,val);
                        }
                        continue;
                   }
                   //todo 基本类型

                   //字符串
                    if (method != null) {
                        method.invoke(nclone,chgDetlDTO.getChgOldVal());
                    }
                } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
                    throw new MbsException("反射执行方法失败"+e.getMessage());
                }
            }
        }
        return nclone;
    }

    */
/**
     *  下划线转驼峰
     * @param param
     * @param
     *
     * @return
     *//*


    public static String underlineToCamel(String param) {
        if (param == null || "".equals(param.trim())) {
            return "";
        }
        if (!param.contains("_")){
            return param;
        }
        int len = param.length();
        StringBuilder sb = new StringBuilder(len);
        Boolean flag = false;
        for (int i = 0; i < len; i++) {
            char c = param.charAt(i);
            if (c == '_') {
                flag = true;
                continue;
            } else {
                if (flag == true) {
                    sb.append(Character.toUpperCase(param.charAt(i)));
                    flag = false;
                } else {
                    sb.append(Character.toLowerCase(param.charAt(i)));
                }
            }
        }
        return sb.toString();
    }

    */
/**
     * 对比两个实体类的相同属性值是否相同
     * @Param: oldData 旧值
     * @Param: newData 新值
     * @Param: t 接收变更结果的类型必须继承InsuChgDetlDTO (重要字段：excludeFlag是否过滤经办、创建信息，excludeArg要过滤对比的字段)
     * @return: list<T> 返回属性改变的属性
     * @author:
     * @date: 2019/12/21
     **//*

    public static <O, N, T extends InsuChgDetlDTO> List<T> compareChangeItem(O oldData, N newData, T t) throws MbsException {
        Map oldMap = BeanMap.create(oldData);
        Map newMap = BeanMap.create(newData);

        List<T> insuChgDetlDTOList = new ArrayList<>();
        InsuChgDetlDTO insuChgDetlDTO;
        T tempT;
        Object newObj;
        Object oldObj;
        List<String> excludeArgList = new ArrayList<>();

        if(!ValidateUtil.isEmpty(t.getExcludeArg())){
            excludeArgList.addAll(Arrays.asList(t.getExcludeArg().split(",")));
        }

        //默认过滤掉经办信息、创建信息
        if(t.isExcludeFlag()){
            excludeArgList.addAll(t.getExcludeArgList());
        }
        Map.Entry entry;
        try {
            Iterator<Object> it = newMap.entrySet().iterator();
            while(it.hasNext()){
                entry = (Map.Entry)it.next();
                Object key = entry.getKey();
                if (excludeArgList.contains(key)) continue;
                if (excludeArgList.contains(key)) continue;
                newObj = entry.getValue();
                oldObj = oldMap.get(key);
                if(ValidateUtil.isEmpty(newObj) && ValidateUtil.isEmpty(oldObj)){
                    continue;
                } else if((!ValidateUtil.isEmpty(newObj))
                        && newObj.equals(ValidateUtil.isEmpty(oldObj) ? "" : oldObj)){
                    continue;
                }

                tempT = (T)t.getClass().newInstance();
                insuChgDetlDTO = tempT;
                insuChgDetlDTO.setChgItemTab(t.getChgItemTab());
                insuChgDetlDTO.setChgItem((String)key);
                insuChgDetlDTO.setChgNewVal(changValTypeToStr(newObj));
                insuChgDetlDTO.setChgOldVal(changValTypeToStr(oldObj));

                //查询字段含义，码值对应的描述
                insuChgDetlDTO.setChgItemChn(BusinessCacheUtil.getColumnComment(insuChgDetlDTO.getChgItemTab(),insuChgDetlDTO.getChgItem()).getColumnComment());
                insuChgDetlDTO.setChgNewValDscr(getDict(insuChgDetlDTO.getChgItem(),insuChgDetlDTO.getChgNewVal()));
                insuChgDetlDTO.setChgOldValDscr(getDict(insuChgDetlDTO.getChgItem(),insuChgDetlDTO.getChgOldVal()));
                insuChgDetlDTOList.add(tempT);
            }

            */
/*for(Object key : newMap.keySet()){
                if (excludeArgList.contains(key)) continue;
                // 新值、旧值都为空，新值不为空、旧值和新值相等，进入下一个循环
                newObj = newMap.get(key);
                oldObj = oldMap.get(key);
                if(ValidateUtil.isEmpty(newObj) && ValidateUtil.isEmpty(oldObj)){
                    continue;
                } else if((!ValidateUtil.isEmpty(newObj))
                        && newObj.equals(ValidateUtil.isEmpty(oldObj) ? "" : oldObj)){
                    continue;
                }

                tempT = (T)t.getClass().newInstance();
                insuChgDetlDTO = tempT;
                insuChgDetlDTO.setChgItem((String)key);
                insuChgDetlDTO.setChgNewVal(changValTypeToStr(newObj));
                insuChgDetlDTO.setChgOldVal(changValTypeToStr(oldObj));

                //查询字段含义，码值对应的描述
//                insuChgDetlDTO.setChgItemChn();
//                insuChgDetlDTO.setChgNewValDscr();
//                insuChgDetlDTO.setChgOldValDscr();
                insuChgDetlDTOList.add(tempT);
            }*//*

        } catch (Exception e){
            throw new MbsException(e.getMessage() + ThrowableUtil.getErrorNo(CLASS_ALIAS));
        }

        return insuChgDetlDTOList;
    }
    */
/**
     * 对比两个实体类的相同属性值是否相同
     * @Param: oldData 旧值
     * @Param: newData 新值
     * @Param: t 接收变更结果的类型必须继承InsuChgDetlDTO (重要字段：excludeFlag是否过滤经办、创建信息，excludeArg要过滤对比的字段)
     * @return: list<T> 返回属性改变的属性
     * @author:
     * @date: 2019/12/21
     **//*

    public static <O, N, T extends InsuChgDetlDTO> List<T> compareChangeItem(O oldData, N newData, T t, Map<String,Map<String,String>> mapMap) throws MbsException {
        Map oldMap = BeanMap.create(oldData);
        Map newMap = BeanMap.create(newData);

        List<T> insuChgDetlDTOList = new ArrayList<>();
        InsuChgDetlDTO insuChgDetlDTO;
        T tempT;
        Object newObj;
        Object oldObj;
        List<String> excludeArgList = new ArrayList<>();

        if(!ValidateUtil.isEmpty(t.getExcludeArg())){
            excludeArgList.addAll(Arrays.asList(t.getExcludeArg().split(",")));
        }

        //默认过滤掉经办信息、创建信息
        if(t.isExcludeFlag()){
            excludeArgList.addAll(t.getExcludeArgList());
        }
        Map.Entry entry;
        try {
            Iterator<Object> it = newMap.entrySet().iterator();
            while(it.hasNext()){
                entry = (Map.Entry)it.next();
                Object key = entry.getKey();
                if (excludeArgList.contains(key)) continue;
                if (excludeArgList.contains(key)) continue;
                newObj = entry.getValue();
                oldObj = oldMap.get(key);
                if(ValidateUtil.isEmpty(newObj) && ValidateUtil.isEmpty(oldObj)){
                    continue;
                } else if((!ValidateUtil.isEmpty(newObj))
                        && newObj.equals(ValidateUtil.isEmpty(oldObj) ? "" : oldObj)){
                    continue;
                }
                tempT = (T)t.getClass().newInstance();
                insuChgDetlDTO = tempT;
                insuChgDetlDTO.setChgItemTab(t.getChgItemTab());
                insuChgDetlDTO.setChgItem((String)key);
                insuChgDetlDTO.setChgNewVal(changValTypeToStr(newObj));
                insuChgDetlDTO.setChgOldVal(changValTypeToStr(oldObj));
                //查询字段含义，码值对应的描述
                insuChgDetlDTO.setChgItemChn(BusinessCacheUtil.getColumnComment(insuChgDetlDTO.getChgItemTab(),insuChgDetlDTO.getChgItem()).getColumnComment());
                insuChgDetlDTO.setChgNewValDscr(CollectionUtil.isNotEmpty(mapMap.get(insuChgDetlDTO.getChgItem()))?mapMap.get(insuChgDetlDTO.getChgItem()).get(insuChgDetlDTO.getChgNewVal()): BusinessConst.FIELD_TYPE_STRING_NULL);
                insuChgDetlDTO.setChgOldValDscr(CollectionUtil.isNotEmpty(mapMap.get(insuChgDetlDTO.getChgItem()))?mapMap.get(insuChgDetlDTO.getChgItem()).get(insuChgDetlDTO.getChgOldVal()): BusinessConst.FIELD_TYPE_STRING_NULL);
                insuChgDetlDTOList.add(tempT);
            }
        } catch (Exception e){
            throw new MbsException(e.getMessage() + ThrowableUtil.getErrorNo(CLASS_ALIAS));
        }

        return insuChgDetlDTOList;
    }

    */
/**
     * 对比两个实体类的相同属性值是否相同(指定对比属性)
     * @Param: oldData 旧值
     * @Param: newData 新值
     * @Param: t 接收变更结果的类型必须继承InsuChgDetlDTO
     * @Param: specifiedArg 指定要对比的属性
     * @return: list<T> 返回属性改变的属性
     * @author:
     * @date: 2019/12/21
     **//*

    public static <O, N, T extends InsuChgDetlDTO> List<T> compareChangeItemByStr(O oldData, N newData, Class<T> t,
                                                                                  String... specifiedArg) throws MbsException {
        Map oldMap = BeanMap.create(oldData);
        Map newMap = BeanMap.create(newData);

        List<T> insuChgDetlDTOList = new ArrayList<>();
        InsuChgDetlDTO insuChgDetlDTO;
        T tempT;
        Object newObj;
        Object oldObj;
        List<String> specifiedArgList = Arrays.asList(specifiedArg);
        try {
            for(String key : specifiedArgList){
                // 新值、旧值都为空，新值不为空、旧值和新值相等，进入下一个循环
                newObj = newMap.get(key);
                oldObj = oldMap.get(key);
                if(ValidateUtil.isEmpty(newObj) && ValidateUtil.isEmpty(oldObj)){
                    continue;
                } else if((!ValidateUtil.isEmpty(newObj))
                        && newObj.equals(ValidateUtil.isEmpty(oldObj) ? "" : oldObj)){
                    continue;
                }

                tempT = t.newInstance();
                insuChgDetlDTO = tempT;
                insuChgDetlDTO.setChgItem(key);
                insuChgDetlDTO.setChgNewVal(changValTypeToStr(newObj));
                insuChgDetlDTO.setChgOldVal(changValTypeToStr(oldObj));

                //查询字段含义，码值对应的描述
//                insuChgDetlDTO.setChgItemChn();
                insuChgDetlDTO.setChgNewValDscr(getDict(insuChgDetlDTO.getChgItem(), insuChgDetlDTO.getChgNewVal()));
                insuChgDetlDTO.setChgOldValDscr(getDict(insuChgDetlDTO.getChgItem(), insuChgDetlDTO.getChgOldVal()));
                insuChgDetlDTOList.add(tempT);
            }
        } catch (Exception e){
            throw new MbsException(e.getMessage() + ThrowableUtil.getErrorNo(CLASS_ALIAS));
        }

        return insuChgDetlDTOList;
    }

    */
/**
     * 转换传入值为字符串
     * @Param: obj
     * @return:
     * @author:
     * @date: 2019/12/21
     **//*

    private static String changValTypeToStr(Object obj){
        if(ValidateUtil.isEmpty(obj)){
            return null;
        }
        if(obj instanceof Date){
            return DateUtil.date2Str((Date)obj, "yyyy-MM-dd");
        } else {
            return String.valueOf(obj);
        }
    }


    */
/**
     * 查询字段的码值中文含义
     * @Param: strKey 查询字段名
     * @Param: strValue 查询代码
     * @return: 码值中文含义
     * @author:
     * @date: 2020/3/7
     **//*

    public static String getDict(String strKey, String strValue){
        if(ValidateUtil.isEmpty(strValue)){
            return "";
        }

        DataDictDO dataDictDO = null;
        try {
            dataDictDO = DictUtils.getDict(strKey, strValue);
            if(ValidateUtil.isEmpty(dataDictDO.getLabel())){
                return "";
            }
        } catch (Exception e) {
            dataDictDO = new DataDictDO();
        }

        return dataDictDO.getLabel();
    }

    */
/**
     * 查询字段的码值
     * @Param: strKey 查询字段名
     * @Param: strLabel 查询label
     * @return: 码值中文含义
     * @author:
     * @date: 2020/3/7
     **//*

    public static String getDictCode(String strKey, String strLabel){
        if(ValidateUtil.isEmpty(strLabel)){
            return "";
        }
        try {
            List<DataDictDO> list = DictUtils.getCodeList(strKey,"1");
            if(ValidateUtil.isEmpty(list)){
                return "";
            }else{
                for(DataDictDO dataDictDO : list){
                    if(strLabel.equals(dataDictDO.getLabel())){
                        return dataDictDO.getValue();
                    }
                }
            }
        } catch (Exception e) {
            return "";
        }
        return "";
    }

    */
/**
     * 查询字段所有label
     * @Param: codeType 查询字典名
     * @return: 码值中文含义列表
     * @author:
     * @date: 2020/3/7
     **//*

    public static List<String> getDictLabels(String codeType) throws MbsException {
        if(ValidateUtil.isEmpty(codeType)){
            return null;
        }
        List<String> labels= new ArrayList<>();
        try {
            List<DataDictDO> list= DictUtils.getCodeList(codeType,"1");
            for (DataDictDO dict : list){
                labels.add(dict.getLabel());
            }
        } catch (Exception e) {
            throw new MbsException("获取字典失败！");
        }
        return labels;
    }

    */
/**
     * 校验返回状态，适用wrapperResponse返回值，校验状态，并校验List是否有返回值
     * @Param: wrapperResponse
     * @Param: flag=false（只校验返回状态），true（还要校验必须有返回值）
     * @return: boolean
     * @date: 2020/3/3
     **//*

    public static boolean checkRerurnStatus(WrapperResponse wrapperResponse, boolean flag){
        if(wrapperResponse.getCode() != BusinessConst.CODE_SUCCESS){
            return false;
        } else {
            return !flag || !ValidateUtil.isEmpty(wrapperResponse.getData());
        }


//        if(wrapperResponse.getCode() != BusinessConst.CODE_SUCCESS || (!flag || (ValidateUtil.isEmpty(wrapperResponse.getData())
//                ))){ //  ||(!(wrapperResponse.getData() instanceof List) || ((List) wrapperResponse.getData()).size() > 0)
//
//            return false;
//        }
    }

    */
/**
     * 驼峰转下划线
     * @param str
     * @return
     *//*

    public static StringBuffer underline(StringBuffer str) {
        Pattern pattern = Pattern.compile("[A-Z]");
        Matcher matcher = pattern.matcher(str);
        StringBuffer sb = new StringBuffer(str);
        if(matcher.find()) {
            sb = new StringBuffer();
            //将当前匹配子串替换为指定字符串，并且将替换后的子串以及其之前到上次匹配子串之后的字符串段添加到一个StringBuffer对象里。
            //正则之前的字符和被替换的字符
            matcher.appendReplacement(sb,"_"+matcher.group(0).toLowerCase());
            //把之后的也添加到StringBuffer对象里
            matcher.appendTail(sb);
        }else {
            return sb;
        }
        return underline(sb);
    }

    */
/**
     * 将险种名称转化未简称
     **//*

    public static String convertSimpleIns(List<String> insuTypeCodes) {
        if(ValidateUtil.isEmpty(insuTypeCodes)){
            return null;
        }

        StringBuilder insResult = new StringBuilder();
        for (String insType : insuTypeCodes) {
            if (ValidateUtil.isNotEmpty(insType)) {
                if (BusinessConst.INSUTYPE_JBYLBX.equals(insType)) {
                    insResult.append("基本，");
                }
                if (BusinessConst.INSUTYPE_GWYYLBZ.equals(insType)) {
                    insResult.append("公补，");
                }
                if (BusinessConst.INSUTYPE_GEBCYLBX.equals(insType)) {
                    insResult.append("大额，");
                }
                if (BusinessConst.INSUTYPE_SYBX.equals(insType)) {
                    insResult.append("生育，");
                }
                if (BusinessConst.INSUTYPE_JMYLBX.equals(insType)) {
                    insResult.append("城居，");
                }
                if (BusinessConst.INSUTYPE_ETTC.equals(insType)) {
                    insResult.append("儿童，");
                }
                if (BusinessConst.INSUTYPE_GCC.equals(insType)) {
                    insResult.append("高层次，");
                }
                if (BusinessConst.INSUTYPE_LXYLBX.equals(insType)) {
                    insResult.append("离休，");
                }
                if (BusinessConst.INSUTYPE_EY.equals(insType)) {
                    insResult.append("二乙，");
                }
                if (BusinessConst.INSUTYPE_ZH.equals(insType)) {
                    insResult.append("照护，");
                }
                if (BusinessConst.INSUTYPE_ZGDB.equals(insType)) {
                    insResult.append("职工大病，");
                }
                if (BusinessConst.INSUTYPE_DFBC.equals(insType)) {
                    insResult.append("地方补充，");
                }
                if (BusinessConst.INSUTYPE_QYBC.equals(insType)) {
                    insResult.append("企业补充，");
                }
            }
        }
        if (!ValidateUtil.isEmpty(insResult.toString())) {
            return insResult.toString().substring(0, insResult.length() - 1);
        }
        return "";
    }
    public static String getRuleName(String ruleId){
        RuleUtil ruleUtil = SpringContextUtils.getBean("ruleUtil");
        RuleDTO ruleDTO = ruleUtil.loadRule(ruleId);
        return ruleDTO.getRuleName();
    }

    */
/**
     * inputParam 将指标项按指标分类放入Map返回
     * @param inputParam
     * @return
     * @throws Exception
     *//*

    public static Map<String,Object> convertMap(Map<String,Object> inputParam) {
        Map resultMap = new HashMap();
        Map<String,Object> map =null;
        Map inputMap = new MapBuilder<>().putAll(inputParam).toMap();
        try {
            ClassPathResource classPathResource = new ClassPathResource("indiConfig/indiTypes.json");
            String str = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(),"UTF-8"));
            map = JSONObject.parseObject(str, Hashtable.class);
            for (Map.Entry<String,Object> entry : map.entrySet()) {
                String key = entry.getKey();
                Object valueObj = entry.getValue();
                boolean checkMap = false;
                // 获取所有的key
                String valueStrs;
                Map<String, String> buffermap = new HashMap<>();
                if(valueObj instanceof JSONObject){
                    JSONObject value = (JSONObject)valueObj;
                    valueStrs = "";
                    buffermap = getAllKeys(value);
                    checkMap = true;
                }else if(valueObj instanceof JSONArray){
                    JSONArray value = (JSONArray)valueObj;
                    valueStrs = getAllKey(value).toString();
                }else{
                    valueStrs = valueObj.toString();
                }
                // 按指标分类分装
                Map  kidMap = new ConcurrentHashMap();
                Iterator<Map.Entry<String, Object>> inputIter = inputMap.entrySet().iterator();
                while (inputIter.hasNext()){
                    Map.Entry<String,Object> inputEntry = inputIter.next();
                    if(ValidateUtil.isEmpty(inputEntry.getValue())){
                        inputIter.remove();
                        continue;
                    }
                    if(checkMap){
                        for(String mapKey:buffermap.keySet()){
                            if(mapKey.equals(inputEntry.getKey())){
                                kidMap.put(inputEntry.getKey(),inputEntry.getValue());
                                inputIter.remove();
                            }
                        }
                    }else{
                        if(valueStrs.contains(inputEntry.getKey())){
                            kidMap.put(inputEntry.getKey(),inputEntry.getValue());
                            inputIter.remove();
                        }
                    }
                }
                if(!ValidateUtil.isEmpty(kidMap.values())){
                    resultMap.put(key,kidMap);
                }
            }
            resultMap.putAll(inputMap);
        } catch (Exception e) {
            System.out.println(e.getMessage());;
        }
        return resultMap;
    }
    */
/**
     * 递归读取所有的key
     *
     * @param jsonObject
     *//*

    public static Map<String,String> getAllKeys(JSONObject jsonObject) {
        Map<String,String> buffermap = new HashMap<>();
        Iterator<String> keys = jsonObject.keySet().iterator();// jsonObject.keys();
        while (keys.hasNext()) {
            String key = keys.next();
            buffermap.put(key,key);
        }
        return buffermap;
    }
    */
/**
     * 递归读取所有的key
     *
     * @param jsonObject
     *//*

    public static StringBuffer getAllKey(JSONObject jsonObject) {
        StringBuffer stringBuffer = new StringBuffer();
        Iterator<String> keys = jsonObject.keySet().iterator();// jsonObject.keys();
        while (keys.hasNext()) {
            String key = keys.next();
            stringBuffer.append(key.toString()).append("|");
            if (jsonObject.get(key) instanceof JSONObject) {
                JSONObject innerObject = (JSONObject) jsonObject.get(key);
                stringBuffer.append(getAllKey(innerObject));
            } else if (jsonObject.get(key) instanceof JSONArray) {
                JSONArray innerObject = (JSONArray) jsonObject.get(key);
                stringBuffer.append(getAllKey(innerObject));
            }
        }
        return stringBuffer;
    }
    */
/**
     * 递归读取所有的key
     *
     * @param json1
     *//*

    public static StringBuffer getAllKey(JSONArray json1) {
        StringBuffer stringBuffer = new StringBuffer();
        if (json1 != null ) {
            Iterator i1 = json1.iterator();
            while (i1.hasNext()) {
                Object key = i1.next();
                if (key instanceof  JSONObject) {
                    JSONObject innerObject = (JSONObject) key;
                    stringBuffer.append(getAllKey(innerObject));
                } else if (key instanceof JSONArray) {
                    JSONArray innerObject = (JSONArray) key;
                    stringBuffer.append(getAllKey(innerObject));
                }else{
                }
            }
        }
        return stringBuffer;
    }


    */
/**
     * 对当事人的姓名、证件号码进行拼接
     * @date: 2020/3/30
     **//*

    public static String concatNameCertNo(String name, String certNo){
        StringBuffer sb = new StringBuffer();
        if(ValidateUtil.isNotEmpty(name)){
            sb.append(name);
        }
        if(ValidateUtil.isNotEmpty(certNo)){
            sb.append("[").append(certNo).append("]");
        }

        return sb.toString();
    }

    */
/**
     * 根据险种码值获取险种中文名称
     * @param insuType
     * @return
     *//*

    public static String getInsuByType(String insuType) throws MbsException {
        String insuName=insuMap.get(insuType);
        if(StringUtils.isNullOrEmpty(insuName)){
            DataDictDO dataDictDO=DictUtils.getDict("INSUTYPE",insuType);
            if(ValidateUtil.isEmpty(dataDictDO)||ValidateUtil.isEmpty(dataDictDO.getLabel())){
                throw new MbsException(BusinessConst.CODE_ERROR,"未获取到险种【"+insuType+"】的中文含义");
            }else{
                insuName = dataDictDO.getLabel();
                insuMap.put(insuType,insuName);
            }
        }
        return insuName;
    }

    */
/**
     * 获取上级级联医保区划
     * @return
     *//*

    public static List<String> getTreeAdmdvs(String admdvsValue) throws Exception{
        List<String> result=new ArrayList<>();
        result.add(0,admdvsValue);
        List<AdmdvsDTO> admdvs = Collections.emptyList();
        Object o= CacheUtil.getObj(BusinessConst.INSU_ADMDVS_ALL_CACHE_KEY);
        if(ValidateUtil.isEmpty(o)){
            RedisLock redisLock = redisLockFactory.newLock(BusinessConst.INSU_ADMDVS_ALL_CACHE_KEY, Duration.ofSeconds(12));
            redisLock.lock();
            QAdmdvsDTO qAdmdvsDTO = new QAdmdvsDTO();
            try {
                qAdmdvsDTO.setValiFlag(BusinessConst.VALI_FLAG_1_YX);
                WrapperResponse<List<AdmdvsDTO>> listWrapperResponse = queryAdmdvsService1.queryAdmdvsList(qAdmdvsDTO);
                if (checkRerurnStatus(listWrapperResponse, true) && ValidateUtil.isNotEmpty(listWrapperResponse.getData())) {
                    admdvs = listWrapperResponse.getData();
                    CacheUtil.putObj(BusinessConst.INSU_ADMDVS_ALL_CACHE_KEY, admdvs);
                }
            }catch (Exception e){
                throw new MbsException(240101,e.getMessage());
            }finally {
                redisLock.unlock();
            }
        }else{
            admdvs=(List<AdmdvsDTO>)o;
        }
        String parentValue="";
        for (int i=0;i<admdvs.size();i++) {
            AdmdvsDTO admdvsDTO=admdvs.get(i);
            if(admdvsDTO.getAdmdvs().equals(admdvsValue)){
                if(ValidateUtil.isEmpty(admdvsDTO.getPrntAdmdvs())|| BusinessConst.ADMDVS_NATION.equals(admdvsDTO.getPrntAdmdvs()))
                    return result;
                parentValue=admdvsDTO.getPrntAdmdvs();
                result.add(0,parentValue);
                break;
            }
        }
        for (int i=0;i<admdvs.size();i++) {
            AdmdvsDTO admdvsDTO=admdvs.get(i);
            if(admdvsDTO.getAdmdvs().equals(parentValue)){
                if(ValidateUtil.isEmpty(admdvsDTO.getPrntAdmdvs())|| BusinessConst.ADMDVS_NATION.equals(admdvsDTO.getPrntAdmdvs()))
                    return result;
                parentValue=admdvsDTO.getPrntAdmdvs();
                result.add(0,parentValue);
                break;
            }
        }
        return result;
    }

    */
/**
     * 获取上级级联医保区划中文 如：四川省/成都市/金牛区
     * @return
     *//*

    public static String getTreeAdmdvsLabel(String admdvsValue) throws Exception{
        List<String> result=new ArrayList<>();
        List<AdmdvsDTO> admdvs = Collections.emptyList();
        Object o= CacheUtil.getObj(BusinessConst.INSU_ADMDVS_ALL_CACHE_KEY);
        if(ValidateUtil.isEmpty(o)){
            RedisLock redisLock = redisLockFactory.newLock(BusinessConst.INSU_ADMDVS_ALL_CACHE_KEY, Duration.ofSeconds(12));
            redisLock.lock();
            try {
                QAdmdvsDTO qAdmdvsDTO = new QAdmdvsDTO();
                qAdmdvsDTO.setValiFlag(BusinessConst.VALI_FLAG_1_YX);
                WrapperResponse<List<AdmdvsDTO>> listWrapperResponse = queryAdmdvsService1.queryAdmdvsList(qAdmdvsDTO);
                if (checkRerurnStatus(listWrapperResponse, true) && ValidateUtil.isNotEmpty(listWrapperResponse.getData())) {
                    admdvs = listWrapperResponse.getData();
                    CacheUtil.putObj(BusinessConst.INSU_ADMDVS_ALL_CACHE_KEY, admdvs);
                }
            }catch (Exception e){
                throw new MbsException(240101,e.getMessage());
            }finally {
                redisLock.unlock();
            }
        }else{
            admdvs=(List<AdmdvsDTO>)o;
        }
        Map<String,String> map= admdvs.stream().collect(Collectors.toMap(AdmdvsDTO::getAdmdvs,AdmdvsDTO::getAdmdvsName));
        result.add(0,map.get(admdvsValue));
        String parentValue="";
        for (int i=0;i<admdvs.size();i++) {
            AdmdvsDTO admdvsDTO=admdvs.get(i);
            if(admdvsDTO.getAdmdvs().equals(admdvsValue)){
                if(ValidateUtil.isEmpty(admdvsDTO.getPrntAdmdvs())|| BusinessConst.ADMDVS_NATION.equals(admdvsDTO.getPrntAdmdvs()))
                    return list2Str(result);
                parentValue=admdvsDTO.getPrntAdmdvs();
                result.add(0,map.get(parentValue));
                break;
            }
        }
        for (int i=0;i<admdvs.size();i++) {
            AdmdvsDTO admdvsDTO=admdvs.get(i);
            if(admdvsDTO.getAdmdvs().equals(parentValue)){
                if(ValidateUtil.isEmpty(admdvsDTO.getPrntAdmdvs())|| BusinessConst.ADMDVS_NATION.equals(admdvsDTO.getPrntAdmdvs()))
                    return list2Str(result);
                parentValue=admdvsDTO.getPrntAdmdvs();
                result.add(0,map.get(parentValue));
                break;
            }
        }
        return list2Str(result);
    }
    private static String list2Str(List<String> list){
        if(ValidateUtil.isNotEmpty(list)){
            StringBuffer sb = new StringBuffer();
            for (String s:list){
                sb.append(s+"/");
            }
            sb.deleteCharAt(sb.length()-1);
            return sb.toString();
        }else {
            return BusinessConst.FIELD_TYPE_STRING_NULL;
        }
    }
    */
/**
     * 传入变更详情列表 返回变更前信息
     * @param newDto
     * @param chgDetls
     * @param <N>
     * @param <T>
     * @return
     *//*

    public static  <N, T extends InsuChgDetlDTO> N getOldInfo(N newDto, List<T> chgDetls) throws MbsException {
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat simpleDateFormat1=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        Field[] fields=newDto.getClass().getDeclaredFields();
        Method[] methods=newDto.getClass().getMethods();
        Map<String,Method> methodMap= new HashMap<>();
        for (Method method:methods){
            methodMap.put(method.getName(),method);
        }
        Map<String,Field> fieldMap=new HashMap<>();
        for (Field field:fields){
            fieldMap.put(field.getName(),field);
        }
        try {
            for (T t: chgDetls) {
                String fieldName=t.getChgItem();
                String setName="set"+fieldName.toUpperCase().substring(0,1)+fieldName.substring(1);
                Method method=methodMap.get(setName);
                if(!ValidateUtil.isEmpty(method)){
                    if(!ValidateUtil.isEmpty(fieldMap.get(fieldName))){
                        Field field=fieldMap.get(fieldName);
                        if(field.getGenericType().toString().equals("class java.lang.String"))
                            method.invoke(newDto,t.getChgOldVal());
                        else if(field.getGenericType().toString().equals("class java.util.Date")){
                            String oldDateValue=t.getChgOldVal();
                            if(oldDateValue.length()==10)
                                method.invoke(newDto,simpleDateFormat.parse(oldDateValue));
                            else if(oldDateValue.length()==19)
                                method.invoke(newDto,simpleDateFormat1.parse(oldDateValue));
                        }
                    }
                }

            }
        }catch (Exception e){
            throw new MbsException(e.getMessage());
        }
        return newDto;
    }

    */
/**
     * 传入变更后的dto和变更详情记录判断dto是否已变更
     * @param newDto
     * @param chgDetls
     * @param <N>
     * @param <T>
     * @return
     *//*

    public static  <N, T extends InsuChgDetlDTO> boolean isInfoChged(N newDto, List<T> chgDetls) throws MbsException {
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat simpleDateFormat1=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        Field[] fields=newDto.getClass().getDeclaredFields();
        Method[] methods=newDto.getClass().getMethods();
        Map<String,Method> methodMap= new HashMap<>();
        for (Method method:methods){
            methodMap.put(method.getName(),method);
        }
        Map<String,Field> fieldMap=new HashMap<>();
        for (Field field:fields){
            fieldMap.put(field.getName(),field);
        }
        try {
            for (T t: chgDetls) {
                String fieldName=t.getChgItem();
                String getName="get"+fieldName.toUpperCase().substring(0,1)+fieldName.substring(1);
                Method method=methodMap.get(getName);
                if(!ValidateUtil.isEmpty(method)){
                    if(!ValidateUtil.isEmpty(fieldMap.get(fieldName))){
                        Field field=fieldMap.get(fieldName);
                        if(t.getChgNewVal()==null&&ValidateUtil.isEmpty(method.invoke(newDto))) {
                            continue;
                        }
                        if((t.getChgNewVal()==null&&!ValidateUtil.isEmpty(method.invoke(newDto)))||
                                (method.invoke(newDto)==null&&!ValidateUtil.isEmpty(t.getChgNewVal()))) {
                            return false;
                        }
                        if(field.getGenericType().toString().equals("class java.lang.String")){
                            if(!t.getChgNewVal().equals(method.invoke(newDto))) {
                                return false;
                            }
                        }
                    }
                }

            }
        }catch (Exception e){
            throw new MbsException(e.getMessage());
        }
        return true;
    }

    public static Map<String,String>  createBizTypeMap(){
        Map<String,String> map=new HashMap<>();
        map.put("mbs-emp-insu-01","参保单位登记");
        map.put("mbs-emp-mnt-01","单位信息维护");
        map.put("mbs-emp-merg-01","单位合并");
        map.put("mbs-emp-splt-01","单位分户");
        map.put("mbs-emp-clchg-01","单位缴费状态变更");
        map.put("mbs-emp-canc-01","单位注销");
        map.put("mbs-emp-ext-01","单位拓展信息管理");
        map.put("mbs-psn-insu-01","职工参保登记");
        map.put("mbs-psn-exins-01","人员终止参保");
        map.put("mbs-flx-insu-01","灵活就业人员参保登记");
        map.put("mbs-psn-paucl-01","参保人员暂停缴费");
        map.put("mbs-psn-merg-01","人员多号合并");
        map.put("mbs-psn-mnt-01","人员信息维护");
        map.put("mbs-retr-insu-01","退休人员参保登记");
        map.put("mbs-flx-paucl-01","灵活就业人员中断缴费");
        map.put("mbs-psn-ext-01","人员扩展信息登记");
        map.put("mbs-psn-retr-01","在职转退休");
        return map;
    }


    //根据码值获取其描述信息
    public static String getLabel(String codeType,String code){
        String label = "";
        //if(code == null || code == ""){
        if(ValidateUtil.isEmpty(code)){
            return label;
        }
        DataDictDO dataDictDO = DictUtils.getDict(codeType,code);
        if(ValidateUtil.isEmpty(dataDictDO)){
            return label;
        }else {
            label = dataDictDO.getLabel();
        }
        return label;
    }


    //避免编译器警告写一个Object转List函数，不使用强转
    public static <T> List<T> castList(Object obj, Class<T> clazz)
    {
        List<T> result = new ArrayList<T>();
        if(obj instanceof List<?>)
        {
            for (Object o : (List<?>) obj)
            {
                result.add(clazz.cast(o));
            }
            return result;
        }
        return null;
    }

    */
/*
     * 判断对象值是否相等
     *
     * @param val
     * @param old
     * @returns boolean
     *//*

    public static boolean checkIsEquals(Object val,Object old) throws Exception {
        Map<String, Object> valMap = null;
        Map<String, Object> oldMap = null;
        valMap = objToMap(val);
        oldMap = objToMap(old);
        Map<String, Object> tempMap;
        if(valMap.size() > oldMap.size()){
            tempMap = valMap;
            valMap = oldMap;
            oldMap = tempMap;
        }
        for(Map.Entry<String, Object> key : valMap.entrySet()){
            if(ValidateUtil.isEmpty(key.getValue())){
                if(!ValidateUtil.isEmpty(oldMap.get(key.getKey()))){
                    return false;
                }
            }else {
                if(key.getValue() instanceof String){
                    if(!key.getValue().equals(oldMap.get(key.getKey()))){
                        return false;
                    }
                }else if(key.getValue() instanceof Date){
                    boolean flag = isSameDay((Date) key.getValue(), (Date) oldMap.get(key.getKey()));
                    if(!flag){
                        return false;
                    }
                }
            }
        }
        return true;
    }

    */
/**
     * 对象转map
     *
     * @param obj 对象
     * @throws Exception
     *//*

    public static Map<String, Object> objToMap(Object obj) throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        // 获取f对象对应类中的所有属性域
        Field[] fields = obj.getClass().getDeclaredFields();
        for (int i = 0, len = fields.length; i < len; i++) {
            String varName = fields[i].getName();
            //将key置为小写，默认为对象的属性
            varName = varName.toLowerCase();
            try {
                // 获取原来的访问控制权限
                boolean accessFlag = fields[i].isAccessible();
                // 修改访问控制权限
                fields[i].setAccessible(true);
                // 获取在对象f中属性fields[i]对应的对象中的变量
                Object o = fields[i].get(obj);
                map.put(varName, o);
                ;
                // 恢复访问控制权限
                fields[i].setAccessible(accessFlag);
            } catch (IllegalArgumentException | IllegalAccessException ex) {
                throw new Exception(ex.getMessage());
            }
        }
        return map;
    }

    */
/*
     * 时间是否再同一天
     *
     * @param cal1
     * @param cal2
     * @returns boolean
     *//*

    public static boolean isSameDay(Calendar cal1, Calendar cal2) {
        if(cal1 != null && cal2 != null) {
            return cal1.get(0) == cal2.get(0) && cal1.get(1) == cal2.get(1) && cal1.get(6) == cal2.get(6);
        } else {
            return false;
        }
    }

    */
/*
     * 时间是否再同一天
     *
     * @param date1
     * @param date2
     * @returns boolean
     *//*

    public static boolean isSameDay(Date date1, Date date2) {
        if(date1 != null && date2 != null) {
            Calendar cal1 = Calendar.getInstance();
            cal1.setTime(date1);
            Calendar cal2 = Calendar.getInstance();
            cal2.setTime(date2);
            return isSameDay(cal1, cal2);
        } else {
            return false;
        }
    }

    */
/**
     * @param type
     * @param value
     * @param dicMap
     * @return
     *//*

    public static String getDict(String type, String value, Map<String, TaDictCache> dicMap) {
        String label = "";
        if (ValidateUtil.isEmpty(value)) {
            return label;
        }
        DataDictDO dataDictDO = getDataDictDO(type,"",value,dicMap);
        if (ValidateUtil.isEmpty(dataDictDO)) {
            return label;
        } else {
            label = dataDictDO.getLabel();
        }
        return label;
    }


    */
/**
     *
     * @param type 类型
     * @param label 名
     * @param value 值
     * @param dicMap
     * @return
     *//*

    public static DataDictDO getDataDictDO(String type, String label,String value,Map<String, TaDictCache> dicMap) {
        if (ValidateUtil.isEmpty(value)&&ValidateUtil.isEmpty(label)) {
            return new DataDictDO();
        } else {
            if (ValidateUtil.isEmpty(dicMap)) {
                return new DataDictDO();
            } else {
                TaDictCache appCache = dicMap.get(type);

                if (ValidateUtil.isEmpty(appCache)) {
                    return new DataDictDO();
                }
                List<DataDictDO> codeList =  new ArrayList<>();

                if(!"".equals(label)){
                    codeList = (List) appCache.getList().stream().filter((code) -> {
                        return label.equals(code.getLabel());
                    }).collect(Collectors.toList());
                }else{
                    codeList = (List) appCache.getList().stream().filter((code) -> {
                        return value.equals(code.getValue());
                    }).collect(Collectors.toList());
                }
                if (codeList.isEmpty()) {
                    return new DataDictDO();
                } else {
                    if (1 < codeList.size()) {
                        log.error("获取单条缓存时返回多条缓存数据！");
                    }
                    return (DataDictDO) codeList.get(0);
                }
            }
        }
    }
}

*/
